﻿
<link href="/ViewV5/CSS/saved_resource.css" rel="stylesheet" />
<link href="/ViewV5/CSS/saved_resource(2).css" rel="stylesheet" />
<script>
    tempindex = avalon.define({
        $id: "TKSTList",
        tkID: ComFunJS.getQueryString("tkid"),
        TKInfo: {}, //题库信息
        KnowLedge: [],
        curKnowLedge: "",
        curLevel: "",
        curType: "",
        TKSTData: [], selNum: function (item) {    //选择显示的条数
            model.page.pagecount = item;
            tempindex.GetLIST();
        },
        InitWigetData: function (strId) {
            tempindex.tkID = strId;
            $.getJSON('/API/VIEWAPI.ashx?Action=KSGL_GETKNOWLEDGE', { P1: tempindex.tkID }, function (result) {
                if (result.ErrorMsg == "") {
                    tempindex.KnowLedge = result.Result;
                }
            })
            $.getJSON('/API/VIEWAPI.ashx?Action=KSGL_GETTKGLMODEL', { P1: tempindex.tkID }, function (result) {
                if (result.ErrorMsg == "") {
                    tempindex.TKInfo = result.Result;
                }
            })

            tempindex.GetLIST();
        }, ImportTKST: function () {
            top.ComFunJS.winviewform('/ViewV5/AppPage/KSGL/TKSTExport.html?tkid=' + tempindex.tkID, "试题导入", "750", "300");
        }, Total: 0, GetLIST: function () {
            $.getJSON("/API/VIEWAPI.ashx?Action=KSGL_GETTKSTLIST", { p: 1, P1: tempindex.curKnowLedge, P2: tempindex.curType, level: tempindex.curLevel, tkid: tempindex.tkID, count: model.page.pagecount }, function (result) {
                if (result.ErrorMsg == "") {
                    tempindex.TKSTData = result.Result;
                    tempindex.Total = result.Result2;
                    var page = 1;
                    laypage({
                        cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                        pages: Math.ceil(parseInt(result.Result2) * 1.0 / 10), //通过后台拿到的总页数
                        curr: 1, //初始化当前页
                        skin: 'molv',
                        jump: function (e) { //触发分页后的回调
                            if (e.curr != page) {
                                $.getJSON("/API/VIEWAPI.ashx?Action=KSGL_GETTKSTLIST", { p: e.curr, P1: tempindex.curKnowLedge, P2: tempindex.curType, level: tempindex.curLevel, tkid: tempindex.tkID, count: model.page.pagecount }, function (result) {
                                    if (result.ErrorMsg == "") {
                                        tempindex.TKSTData = result.Result;
                                    }
                                })
                                page = e.curr;
                            }
                        }
                    });
                }
            })
        }, selKnowLedge: function (item) {
            if (item) {
                tempindex.curKnowLedge = item.KnowLedge;
            } else {
                tempindex.curKnowLedge = "";
            }
            tempindex.GetLIST();
        }, selLevel: function (val) {
            tempindex.curLevel = val;
            tempindex.GetLIST();
        }, selType: function (val) {
            tempindex.curType = val;
            tempindex.GetLIST();
        }, AddTKST: function () {
            top.ComFunJS.winviewform("/ViewV5/AppPage/APP_ADD_WF.html?FormCode=KSGL_TKST&tkid=" + tempindex.tkID, "添加试题", "1000", "700");
        }, DelTKST: function (item) {
            top.ComFunJS.winconfirm("确定要删除此题吗？", function () {
                $.getJSON("/API/VIEWAPI.ashx?Action=KSGL_DELTKST", { P1: item.ID }, function (data) {
                    if (data.ErrorMsg == "") {
                        tempindex.TKSTData.remove(item);
                        top.ComFunJS.winsuccess("删除成功");

                    } else {
                        top.ComFunJS.winsuccess(msg);

                    }
                });
            });
        }, GetNYCD: function (level) {
            var levelName = "";
            switch (level) {
                case 1:
                    levelName = "容易";
                    break;
                case 2:
                    levelName = "较易";
                    break;
                case 3:
                    levelName = "一般";
                    break;
                case 4:
                    levelName = "较难";
                    break;
                case 5:
                    levelName = "难";
                    break;

            }
            return levelName;
        }, ChangeTK: function () {
            model.PageCode = "AppPage/KSGL/TKLIST";
        }, EDITTKST: function (item) {
            top.ComFunJS.winviewform("/ViewV5/AppPage/APP_ADD_WF.html?FormCode=KSGL_TKST&tkid=" + tempindex.tkID + "&ID=" + item.ID, "编辑试题", "1000", "700");
        }

    })

</script>

<div ms-controller="TKSTList">
    <div class="container bg-default maindiv" style="min-width: 1000px">
        <div class="content">
            <!-- 内容 部分 -->
            <div class="exam-report  page_container">
                <div class="m-examHead f-bg ">
                    <!--试卷头信息-->
                    <h1 class="h1"> {{TKInfo.TKName}} </h1>
                    <div class="info">
                        <div class="attention">
                            {{TKInfo.TKDescribe|html}}
                        </div>
                    </div>
                    <!--工具区域-->
                    <div class="tool js_page_tool_frame">

                        <ul data-name="skin" style="width:120px">
                            <li class="tool-blk">
                                <a href="javascript:void(0)" class="btn btn-lg btn-warning " ms-click="ChangeTK()" type="button"><span>返回题库列表</span></a>
                            </li>
                        </ul>
                        <ul data-name="skin" style="width:90px">
                            <li class="tool-blk">
                                <a href="javascript:void(0)" class="btn btn-lg btn-warning " ms-click="AddTKST()" type="button"><span>添加试题</span></a>
                            </li>
                        </ul>
                        <ul data-name="skin" style="width:90px">
                            <li class="tool-blk">
                                <a href="javascript:void(0)" class=" btn btn-lg btn-warning " ms-click="ImportTKST()" type="button"><span>导入试题</span></a>
                            </li>
                        </ul>
                    </div>
                </div>
                <!--进度信息-->
                <div id="ui-progress" class="ui-progress f-shadow" style="z-index: 10; position: static; top: auto; bottom: auto; left: auto;">
                    <div class="navBox" id="page-rules">
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curKnowLedge==''" ms-click="selKnowLedge(null)">全部知识点</a>
                        <a href="javascript:void(0)" class="btn" ms-repeat-item="KnowLedge" ms-class-1="ui-check:curKnowLedge==item.KnowLedge" ms-click="selKnowLedge(item)">{{item.KnowLedge}}</a>
                    </div>
                    <div class="navBox" id="page-rules">
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType==''" ms-click="selType('')">全部</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='单选题'" ms-click="selType('单选题')">单选题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='多选题'" ms-click="selType('多选题')">多选题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='判断题'" ms-click="selType('判断题')">判断题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='填空题'" ms-click="selType('填空题')">填空题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='简答题'" ms-click="selType('简答题')">简答题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='计算题'" ms-click="selType('计算题')">计算题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='绘图题'" ms-click="selType('绘图题')">绘图题</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curType=='论述题'" ms-click="selType('论述题')">论述题</a>
                    </div>
                    <div class="navBox" id="page-rules">
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==''" ms-click="selLevel('')">全部</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==1" ms-click="selLevel(1)">容易</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==2" ms-click="selLevel(2)">较易</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==3" ms-click="selLevel(3)">一般</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==4" ms-click="selLevel(4)">较难</a>
                        <a href="javascript:void(0)" class="btn" ms-class-1="ui-check:curLevel==5" ms-click="selLevel(5)">难</a>
                    </div>
                </div>
                <!-- 试题部分 -->
                <div class="exam-report-cont-blk f-f14" style="float: none;" id="page-body" oncontextmenu="document.all?(window.event.returnValue=false):(event.preventDefault())">
                    <!--oncopy="return false" oncut="return false"-->
                    <div>

                        <div>
                            <div class="m-question question-item " ms-repeat-item="TKSTData">
                                <div class="m-question-title">
                                    <span class="number">{{$index+1}}<i></i></span>
                                    <div class="f-title" ms-html="item.QContent">
                                    </div>
                                    <label class="btntool" style="float:right;margin-right:10px">
                                        难易程度：{{GetNYCD(item.Level)}}
                                        <a ms-click="DelTKST(item)" style="color:rgb(215,48,48)">删除</a>
                                        <a ms-click="EDITTKST(item)" style="color:#018ee8">编辑</a>
                                    </label>
                                </div>
                                <div class="m-question-list-html" ms-if="item.QItem.size()>0">
                                    <div class="m-choicebox">
                                        <ul class="single">
                                            <li class="question-option-list" ms-repeat-el="item.QItem" ms-attr-value="el.ItemName"><span>{{el.ItemName}}</span><div class="option-content">{{el.ItemDesc|html}}</div></li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="m-question-html " style="min-height:67px;" ms-if="item.QItem.size()>0">
                                    <div class=" m-questiontoolbar">
                                        <div class="m-checkBox single">
                                            <a class="question-option-list" ms-repeat-el="item.QItem" href="javascript:void(0)" ms-attr-value="el.ItemName">{{el.ItemName}}</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="answer clearfix question-answer-bar" style="margin-top: 0px;">
                                    <div class="answer-tool" style="padding: 15px 0px 15px 0px;">
                                        <div class="f-fl"><span class="txt">参考答案：</span><span class="option right" ms-if="item.QAnswer==''">暂未提供参考答案</span><span class="txt f-dn page-shuffle-answer" ms-if="item.QAnswer==''">我的答案：</span><span class="option right" ms-if="item.QAnswer!=''">{{item.QAnswer|html}}</span></div>
                                    </div>
                                </div>
                            </div>
                            <div class="ui-datatable-page ft14 pl20">
                                <div id="pageDiv" ms-visible="tempindex.Total>tempindex.pageNum[0].num" class="pull-right"></div>
                                <div class="pull-right" ms-visible="TKSTData.size()!=0">
                                    <span>共{{tempindex.Total}}条记录</span>
                                    <span ms-visible="tempindex.Total>tempindex.pageNum[0].num">
                                        选择每页条数
                                        <select style="height: 25px; width: 50px;" ms-change="selNum(this.value)" ms-duplex="tempindex.page.pagecount">
                                            <option ms-repeat-pg="pageNum" ms-attr-value="pg.num" ms-attr-selected="pg.num==tempindex.page.pagecount?'selected':''">{{pg.num}}</option>
                                        </select>
                                    </span>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <!-- 试题部分 END -->
                <!-- // END -->
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
